#ifndef _POINTLIST_H_
#define _POINTLIST_H_		1
struct pointlist
{
	struct pointlist *prev;
	struct pointlist *next;
};
#define POINTLIST_HEAD_DECLARED(pl_head) struct pointlist *pl_head = (struct pointlist *)calloc(1, sizeof(struct pointlist))
#define POINTLIST_IS_EMPTY(pl_head) pl_head->next == pl_head
#define POINTLIST_OFFSET(struct_type, pointer) ((size_t)&((struct_type *)0)->pointer)
#define POINTLIST_TO_ITEM(pl_tmp, struct_type, pointer) (struct_type *)(((char*)(pl_tmp)) - POINTLIST_OFFSET(struct_type, pointer))
#define POINTLIST_FOR_EACH(pl_tmp, pl_head) for(pl_tmp = (pl_head)->next; pl_tmp != (pl_head); pl_tmp = pl_tmp->next)
extern void pointlist_init(struct pointlist *);
extern void pointlist_add_tail(struct pointlist *, struct pointlist *);
extern void pointlist_del(struct pointlist *, struct pointlist *);
#endif		/* pointlist.h end */